home *** CD-ROM | disk | FTP | other *** search
/ Cracking 2 / Cracking II..iso / Texty / crackme / UCG_SOLN.TXT < prev    next >
Encoding:
Text File  |  1998-12-13  |  12.1 KB  |  316 lines

  1. How to reverse Overbloated Notepad by Flipper (upg).
  2.  
  3. After all as usual lets 'enter in contact' with the program and then
  4. extract some conclutions:
  5.  
  6.         * Register option is available.
  7.         * Heavy disk activity.
  8.         * Check for a good 'Code' is done at next sesion.
  9.         * App1.dat is necesary.
  10.         * App1.cfg is generated if it doens't exist.
  11.         * It was writen in VB :-)
  12.         * A nagscreen appears if you are 'Unregistered' .-)
  13.          
  14.  
  15. Why there are so much disk activity?
  16. Let's use FileMonitor filtered with App1 and the current directory.
  17.  
  18. Seek    \APP1.EXE       SUCCESS  Beginning Offset: 1024 
  19. Read    \APP1.EXE       SUCCESS  Offset: 1024 Length: 4096      
  20. Seek    \APP1.EXE       SUCCESS  Beginning Offset: 5120 
  21. Read    \APP1.EXE       SUCCESS  Offset: 5120 Length: 4096      
  22. Seek    \APP1.EXE       SUCCESS  Beginning Offset: 28160        
  23. Read    \APP1.EXE       SUCCESS  Offset: 28160 Length: 512      
  24. Seek    \APP1.EXE       SUCCESS  Beginning Offset: 9216 
  25. Read    \APP1.EXE       SUCCESS  Offset: 9216 Length: 4096      
  26. Seek    \APP1.EXE       SUCCESS  Beginning Offset: 21504        
  27. Read    \APP1.EXE       SUCCESS  Offset: 21504 Length: 4096     
  28. Open    \APP1.EXE       SUCCESS  OPENEXISTING OPENALWAYS        
  29. Open    \APP1.EX~       NOTFOUND         CREATEALWAYS REPLACEEXISTING   
  30. Open    \APP1.EX~       SUCCESS  CREATENEW CREATEALWAYS 
  31.                                         OPENALWAYS REPLACEEXISTING      
  32. Read    \APP1.EXE       SUCCESS  Offset: 0 Length: 65024        
  33. Write   \APP1.EX~       SUCCESS  Offset: 0 Length: 35840        
  34. Read    \APP1.EXE       SUCCESS  Offset: 35840 Length: 65024    
  35. Close   \APP1.EX~       SUCCESS         
  36. Close   \APP1.EXE       SUCCESS         
  37. Open    \APP1.EXE       SUCCESS OPENEXISTING OPENALWAYS         
  38. Open    \APP1.EX~       SUCCESS OPENEXISTING OPENALWAYS         
  39. Attrib.\APP1.EXE        SUCCESS Get Creation    
  40. Attrib.\APP1.EXE        SUCCESS Get Access      
  41. Attrib.\APP1.EXE        SUCCESS Get Modify      
  42. Attrib.\APP1.EX~        SUCCESS Set Creation    
  43. Attrib.\APP1.EX~        SUCCESS Set Access      
  44. Attrib.\APP1.EX~        SUCCESS Set Modify      
  45. Close   \APP1.EXE       SUCCESS         
  46. Close   \APP1.EX~       SUCCESS         
  47. Open    \APP1.EX~       SUCCESS CREATENEW CREATEALWAYS 
  48.                                         OPENEXISTING OPENALWAYS         
  49. Open    \APP1.DAT       SUCCESS OPENEXISTING OPENALWAYS         
  50. Read    \APP1.DAT       SUCCESS Offset: 0 Length: 512   
  51. Seek    \APP1.EXE       SUCCESS Beginning Offset: 13312 
  52. Read    \APP1.EXE       SUCCESS Offset: 13312 Length: 4096      
  53. Seek    \APP1.EX~       SUCCESS Beginning Offset: 12941 
  54. Read    \APP1.EX~       SUCCESS Offset: 12941 Length: 5 
  55. Seek    \APP1.EX~       SUCCESS Beginning Offset: 12996 
  56. Read    \APP1.EX~       SUCCESS Offset: 12996 Length: 28        
  57. Seek    \APP1.EX~       SUCCESS Beginning Offset: 13992 
  58. Read    \APP1.EX~       SUCCESS Offset: 13992 Length: 5 
  59. Seek    \APP1.EX~       SUCCESS Beginning Offset: 14014 
  60. Read    \APP1.EX~       SUCCESS Offset: 14014 Length: 22        
  61. Seek    \APP1.EX~       SUCCESS Beginning Offset: 17626 
  62. Read    \APP1.EX~       SUCCESS Offset: 17626 Length: 8 
  63. Seek    \APP1.EX~       SUCCESS Beginning Offset: 18313 
  64. Read    \APP1.EX~       SUCCESS Offset: 18313 Length: 5 
  65. Seek    \APP1.EX~       SUCCESS Beginning Offset: 23555 
  66. Read    \APP1.EX~       SUCCESS Offset: 23555 Length: 9 
  67. Read    \APP1.DAT       SUCCESS Offset: 220 Length: 512 
  68. Seek    \APP1.EXE       SUCCESS Beginning Offset: 25600 
  69. Read    \APP1.EXE       SUCCESS Offset: 25600 Length: 2560      
  70. Close   \APP1.DAT       SUCCESS         
  71. Close   \APP1.EX~       SUCCESS         
  72. FindOp.\APP1.EX~        SUCCESS APP1.ex~        
  73. FindOp.\APP1.EX~        SUCCESS APP1.ex~        
  74. FindCl.\APP1.EX~        SUCCESS         
  75. Delete  \APP1.EX~       SUCCESS         
  76. FindNe.\APP1.EX~        NOMORE          
  77. FindCl.\APP1.EX~        SUCCESS         
  78. Seek    \APP1.EXE       SUCCESS Beginning Offset: 17408 
  79. Read    \APP1.EXE       SUCCESS Offset: 17408 Length: 4096      
  80. Open    \VALIDATE.DAT   NOTFOUND OPENEXISTING OPENALWAYS        
  81. Open    \APP1.KEY       NOTFOUND OPENEXISTING OPENALWAYS        
  82. Open    \CHCKSUM.DAT    NOTFOUND OPENEXISTING OPENALWAYS        
  83. Open    \A_VERIFY.REG   NOTFOUND OPENEXISTING OPENALWAYS        
  84. Open    \EB6A           NOTFOUND OPENEXISTING OPENALWAYS        
  85. Open    \EB6B           NOTFOUND OPENEXISTING OPENALWAYS        
  86. Open    \EB6C           NOTFOUND OPENEXISTING OPENALWAYS        
  87. ..
  88. ..
  89. Open    \ED9H           NOTFOUND OPENEXISTING OPENALWAYS        
  90. Open    \ED9I           NOTFOUND OPENEXISTING OPENALWAYS        
  91. Open    \ED9J           NOTFOUND OPENEXISTING OPENALWAYS        
  92. Open    \PATCH.EXE      NOTFOUND OPENEXISTING OPENALWAYS        
  93. Open    \A.DAT          NOTFOUND OPENEXISTING OPENALWAYS        
  94. Open    \APP1.CFG       SUCCESS  OPENEXISTING OPENALWAYS        
  95. Read    \APP1.CFG       SUCCESS  Offset: 0 Length: 512  
  96. Read    \APP1.CFG       SUCCESS  Offset: 180 Length: 512        
  97. Close   \APP1.CFG       SUCCESS         
  98.  
  99.  
  100.  
  101. Conclutions:
  102.  
  103.         1. Files named EB6A,EB6B...ED9J  are generated
  104.            by a bucle and are fog to our eyes...so ignore them.
  105.         2. Files APP1.KEY, VALIDATE.DAT, CHCKSUM.DAT and
  106.            A_VERIFY.REG are only opened and closed (not read),
  107.            so it may only check for it existence.
  108.         3. The only file read is APP1.DAT.
  109.         4. File App1.ex~ is copy of App1.exe ==> file check
  110.                                                  integrity?
  111.  
  112. Let's use the normal aproach to all UserName/RegisterCode schemes.
  113. bpx at nagscreen====>bpx rtcmsgbox (this is the MessageBoxA 
  114. VB function) and F11.
  115.  
  116. Now, write down the address (4055A0) and W32Dasm.
  117.  
  118.  
  119. * Referenced by a CALL at Address:00404030   
  120. |
  121. 405512     push ebp
  122. 405513     mov ebp, esp
  123. ..
  124. ..
  125. 405595     lea eax, dword ptr [ebp-20]
  126. 405598     push 00000010
  127. 40559A     push eax
  128. 40559B     Call 00401396                ;rtcMsgBox
  129. 4055A0     lea eax, dword ptr [ebp-50]
  130.  
  131.  
  132. And at 404030:
  133.  
  134. * Referenced by a  Jump at Address:403ED8(C)
  135. |
  136. 404030 E8DD140000              call 00405512
  137.  
  138.  
  139. So 
  140.  
  141. * Referenced by a Jump at Address:0040252A(U)
  142. |
  143. 403E43    push ebp
  144. 403E44    mov ebp, esp
  145. 403E46    sub esp, 0000000C
  146. 403E49    push 004012A6
  147. 403E4E    mov eax, dword ptr fs:[00000000]
  148. 403E54    push eax
  149. 403E55    mov dword ptr fs:[00000000], esp
  150. 403E5C    sub esp, 000000F8
  151. 403E62    mov eax, dword ptr [ebp+08]
  152. 403E65    and dword ptr [ebp+08], FFFFFFFE
  153. 403E69    and eax, 00000001
  154. 403E6C    mov [ebp-08], 00401038
  155. 403E73    push ebx
  156. 403E74    mov dword ptr [ebp-04], eax
  157. 403E77    mov eax, dword ptr [ebp+08]
  158. 403E7A    push esi
  159. 403E7B    push edi
  160. 403E7C    mov ebx, dword ptr [eax]
  161. 403E7E    mov dword ptr [ebp-0C], esp
  162. 403E81    push eax
  163. 403E82    call [ebx+04]
  164. 403E85    mov ax, word ptr [00408030] <== Ok 
  165. this is our flag!!! 
  166. 403E8B xor esi, esi 
  167. 403E8D cmp ax, 03FB 
  168. 403E91 mov dword ptr [ebp-18], esi .. .. 
  169. 403EB8 mov dword ptr [ebp+FFFFFF50], esi 
  170. 403EBE mov dword ptr [ebp+FFFFFF40], esi
  171. 403EC4 jnl 00404035 
  172. 403ECA cmp ax, 001B
  173. 403ECE jle 00404035
  174. 403ED4 cmp ax, 00FE
  175. 403ED8 jle 00404030 <="=" Here .. So the flag is at [408030]: 
  176.  
  177. But, where is modified our flag (searching for 408030 we 
  178. find ocurrences at: 403E85 4042A0 404B95 405242 405296 Let's 
  179. see:
  180. :00403E81 50 push eax 
  181. :00403E82 FF5304 call [ebx+04] 
  182. :00403E85 66A130804000 mov ax, word ptr [00408030] 
  183. :00403E8B 33F6 xor esi, esi 
  184. :00403E8D 663DFB03 cmp ax, 03FB 
  185. :0040429C 50 push eax 
  186. :0040429D FF5104 call [ecx+04] 
  187. :004042A0 66A130804000 mov ax, word ptr [00408030] 
  188. :004042A6 33FF xor edi, edi 
  189. :004042A8 663DFB03 cmp ax, 03FB 
  190. :00404B8E 5E pop esi 
  191. :00404B8F 8D8D18FFFFFF lea ecx, dword ptr [ebp+FFFFFF18] 
  192. :00404B95 66893D30804000 mov word ptr [00408030], di 
  193. :00404B9C 89BDD4FEFFFF mov dword ptr [ebp+FFFFFED4], edi 
  194. :00404BA2 89B5CCFEFFFF mov dword ptr [ebp+FFFFFECC], esi 
  195. :00405231 50 push eax 
  196. :00405232 E807C2FFFF Call 0040143E ;__vbaVarTstEq 
  197. :00405237 6685C0 test ax, ax 
  198. :0040523A 7457 je 00405293 
  199. :0040523C 393D10804000 cmp dword ptr [00408010], edi 
  200. :00405242 66C70530804000FF00 mov word ptr [00408030], 00FF 
  201. :0040524B 750F jne 0040525C 
  202. :0040524D 6810804000 push 00408010 
  203. :00405293 8B4508 mov eax, dword ptr [ebp+08] 
  204. :00405296 66C70530804000FE00 mov word ptr [00408030], 00FE Ok!!! solution is in front of you at this time!!!!! Look at 405237="="> FF Good Guy.
  205.                    FE Bad  Guy.
  206.  
  207. bpx at 405232 and wait.
  208. Look at the stack:
  209.  
  210. ss:esp+0 ==> 2nd Value to Tst
  211. ss:esp+4 ==> 1st Value to Tst
  212.  
  213. e ss:esp+0 => arguments to the function, looking at address 
  214. referenced by the 3er dword  you can see the correct code.
  215.  
  216. So: Name: +HCU
  217.     Code: 6AB76748
  218.  
  219. Let's see the posible file integrity check.
  220.  
  221. Seek    \APP1.EX~       SUCCESS Beginning Offset: 12941 
  222. Read    \APP1.EX~       SUCCESS Offset: 12941 Length: 5 
  223. Seek    \APP1.EX~       SUCCESS Beginning Offset: 12996 
  224. Read    \APP1.EX~       SUCCESS Offset: 12996 Length: 28        
  225. Seek    \APP1.EX~       SUCCESS Beginning Offset: 13992 
  226. Read    \APP1.EX~       SUCCESS Offset: 13992 Length: 5 
  227. Seek    \APP1.EX~       SUCCESS Beginning Offset: 14014 
  228. Read    \APP1.EX~       SUCCESS Offset: 14014 Length: 22        
  229. Seek    \APP1.EX~       SUCCESS Beginning Offset: 17626 
  230. Read    \APP1.EX~       SUCCESS Offset: 17626 Length: 8 
  231. Seek    \APP1.EX~       SUCCESS Beginning Offset: 18313 
  232. Read    \APP1.EX~       SUCCESS Offset: 18313 Length: 5 
  233. Seek    \APP1.EX~       SUCCESS Beginning Offset: 23555 
  234. Read    \APP1.EX~       SUCCESS Offset: 23555 Length: 9
  235.  
  236.  
  237. And now look at app1.dat
  238.  
  239. 14989 6338FE068C
  240. 15044 0A886E04050563381E050A8B640405056338FB050A8B570405056F0F
  241. 16040 6338FE068C
  242. 16062 0A888E05050563381E050A8B840505056338FA05787E
  243. 19674 3EC20A81A9070505
  244. 20361 EC49F8FAFA
  245. 25603 5755FA545D80C5780B
  246.  
  247. Do you see something in common????????
  248.  
  249. 14989-2048=12941
  250. 15044-2048=12996
  251. 16040-2048=13992
  252. 16062-2048=14014
  253. 19674-2048=19626
  254. 20361-2048=18313
  255. 25603-2048=23555
  256.  
  257.  
  258. 12941: 66 3D FB 03 89  (from App1.exe offset 12941) 
  259. Xor:   63 38 FE 06 8C  (from App1.dat)
  260. --------------------- 
  261.        05 05 05 05 05 
  262.  
  263. 12996: 0F 8D 6B 01-00 00 66 3D 1B 00 0F 8E 61 01 00 00 66 3D FE ...
  264. Xor:   0A 88 6E 04 05 05 63 38 1E 05 0A 8B 64 04 05 05 63 38 FB ...
  265. -------------------------------------------------------------------
  266.        05 05  05 05 ...
  267.  
  268.  
  269. and more....
  270.  
  271.  
  272. Ok!!! now you can patch is because you know the correct code in
  273. file App1.dat.
  274.  
  275.  
  276. But, why it not checks at:
  277.  
  278. :00405231 50                      push eax
  279. :00405232 E807C2FFFF              Call 0040143E  ;__vbaVarTstEq
  280. :00405237 6685C0                  test ax, ax
  281. :0040523A 7457                    je 00405293 <== Here 'Nopping' 
  282. at 40523A is more than enough to patch the program. The 'KeyMaker' 
  283. Let's use a zen approach. Let's make a table using different 
  284. UserNames and getting the correct code. 
  285.  
  286. UserName Code 
  287. A        6AB65BEC
  288. AA       6AB6B1F4
  289. AAA      6AB707FC
  290. B        6AB65D3F
  291. BB       6AB6B499
  292. BBB      6AB70BF4     
  293. C        6AB65E91
  294. CC       6AB6B73F
  295. CCC      6AB70FED . . . 
  296. Z        6AB67D02 
  297.  
  298. ZZ ... ZZZ ... + 6AB63ECD Nothing 6AB605E3 Look, the increment 
  299. between two consecutive values can be 152h or 153h. Lets make 
  300. the next operation: value of nothing-value of letter. Letter Value 
  301. at first position difference at other positions + 38EA EVEN ODD A 5609 (-1) (+1) B 575B (-1) (0) C 58AD (+1) (0) D 5A01 () E 5B54 () F 5CA7 () G 5DF9 (0) (0) H 5F4C (0) (O) I 609F () J 61F2 () K 6345 () L 6498 (-1) (0) M 65EA () N 674C () O 6890 () P 69E3 (0) (-1) Q 6B36 () R 6C89 (+1) (0) S 6DDB () T 6F2D () U 7081 (0) (0) V 71D4 () W 7327 () X 747A () Y 75CC () Z 771E () The formula is="=">  6AB605E3+(sum of every letter)+differences
  302.  
  303. Now, lets create some codes:
  304.  
  305.         +ABC = 6AB605E3+(38EA+5609+575B+58AD)-1+1=6AB744DE
  306.         +HCU = 6AB605E3+(38EA+5F4E+58AF+7085)+0=6AB76748
  307.         +ALL = 6AB605E3+(38EA+5609+6498+6498)-1-1=6AB75E04
  308.         +RCG = 6AB605E3+(38EA+6C89+58AD+5DF9)+1+0+0=6AB761FD
  309.         APP =  6AB605E3+(5609+69E3+69E3)+0-1=6AB72FB1
  310.         
  311.  
  312. Now, you can find out the missing values and create your own
  313. keymaker.
  314.  
  315.  
  316. +Rcg 1997